/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cz.bsa.soft.i18nparser.core;

import java.io.StringReader;
import java.util.Set;

/**
 *
 * @author vdusa
 */
    public class Parameter implements  I18nPropertiesParser {
        public String name;
        public Object value;
        public String original;

        public Parameter(String name, Object value, String original){
            this.name = name;
            this.value = value;
            this.original = original;
        }

        @Override
        public String toString(){
            return original;
        }

        public Set<I18nProperty> getI18nProperties(){
            if(value instanceof ParameterList){
                return ((ParameterList)value).getI18nProperties();
            } else {
                if(value instanceof String){
                    Parser yyparser = new Parser(new StringReader(value + "\n"));
                    yyparser.yyparse();
                    return yyparser.getI18nProperties();
                } else {
                    System.err.println("Unknown property type");
                    return null;
                }
            }
        }
    }
